<template>
<div>
  <router-view />
  <van-tabbar router v-model="active" fixed placeholder>
    <van-tabbar-item icon="home-o" to="/index">首页</van-tabbar-item>
    <van-tabbar-item icon="orders-o" to="/class">课程</van-tabbar-item>
    <van-tabbar-item icon="orders-o" to="/news">资讯</van-tabbar-item>
    <van-tabbar-item icon="notes-o" to="/yueke">约课记录</van-tabbar-item>
    <van-tabbar-item icon="user-circle-o" to="/my">个人</van-tabbar-item>
  </van-tabbar>
</div>
</template>

<script>
export default {
  name:"home",
  data() {
    return {
      active: 0,
    };
  },
  mounted() {
    const navBarActive = window.location.hash
    if (navBarActive.includes('#/index')) {
      this.active = 0
    } else if (navBarActive.includes('#/class')) {
      this.active = 1
    } else if (navBarActive.includes('#/news')) {
      this.active = 2
    } else if (navBarActive.includes('#/yueke')) {
      this.active = 3
    } else if (navBarActive.includes('#/my')) {
      this.active = 4
    }
  },

};
</script>

<style scoped>

</style>